package com.travel.travelServer.controller;

import com.travel.travelServer.entity.User;
import com.travel.travelServer.service.UserService;
import com.travel.travelServer.utils.ResponseData;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class LoginController {

    @Resource
    private UserService userService;

    @PostMapping("/login")
    public ResponseData login(@RequestBody User user){
        return userService.login(user);
    }

//    @PostMapping("/logout")
//    public ResponseData logout(){
//        return ResponseData.success(userService.logout());
//    }
//
    @PostMapping("/reg")
    public ResponseData reg(@RequestBody User user){
        return ResponseData.success(userService.reg(user));
    }
}
